<template>
    <div>
        <ul class="mui-table-view">
            <li class="mui-table-view-cell mui-media" v-for="item in newsInfo" :key="item.docid">
                <router-link :to="'/home/newsdetials/'+'盗墓笔记'"><!-- '/  /'+'盗墓笔记'-->
                    <img class="mui-media-object mui-pull-left" :src="item.picInfo[0].url"><!--https://ss0.baidu.com/6ONWsjip0QIZ8tyhnq/it/u=2379604797,2960238763&fm=58-->
                    <div class="mui-media-body">
                        <p class='mui-ellipsis'>{{item.digest}}</p>
                        <p class="date-commit"><span>发表时间：{{item.ptime}}</span><span>点击次数{{item.tcount}}</span></p>
                    </div>
                </router-link>
            </li>
        </ul>
    </div>
</template>
<script>
export default {
    data(){
        return{
           newsInfo:[]// 用于存储新闻的数组 一般情况下都会把路由设置成全局的
        }
    },
    created(){
        this.getNewsList();
    },
    methods:{
        getNewsList(){
            this.$http.get("https://www.apiopen.top/journalismApi").then(result=>{
               // console.log(result.body);
                if(result.body.code == 200){
                    let resultInfo = result.body.data;
                    //console.log(resultInfo.auto);
                    this.newsInfo = resultInfo.auto;
                }else {
                    console.log("数据请求失败")
                }

            })
        }
    }
}
</script>
<style scoped lang="less">
.mui-table-view{
    .mui-table-view-cell{
        .mui-ellipsis{
            color: #333333;
            font-size: 16px;
        }
        .date-commit{
            color: deepskyblue;
            display: flex;
            justify-content: space-between;
        }
    }
}
</style>